﻿using Grow.Domain.Object;

namespace Grow.Domain.EventBus.Cap.SubscriberDomainEvents
{
    public class SubscriberDomainEvent : AggregateRootBase
    {

        public SubscriberDomainEvent(Guid id, string environmentName, string eventName, string eventType, string eventHandlerType, string eventBody, SubscriberDomainEventStatus eventStatus, int retryCount, DateTimeOffset sendAt, DateTimeOffset? lockEndTime, DateTimeOffset? expireTime)
        : base(id)
        {
            EnvironmentName = environmentName;
            EventName = eventName;
            EventType = eventType;
            EventHandlerType = eventHandlerType;
            EventBody = eventBody;
            EventStatus = eventStatus;
            RetryCount = retryCount;
            SendAt = sendAt;
            LockEndTime = lockEndTime;
            ExpireTime = expireTime;
        }


        /// <summary>
        /// 主机
        /// </summary>
        public string EnvironmentName { get; set; }
        /// <summary>
        /// 事件名称
        /// </summary>
        public string EventName { get; set; }


        /// <summary>
        /// 事件数据类别
        /// </summary>
        public string EventType { get; set; }
        /// <summary>
        /// 事件处理类别
        /// </summary>
        public string EventHandlerType { get; set; }

        /// <summary>
        /// 事件内容
        /// </summary>
        public string EventBody { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public SubscriberDomainEventStatus EventStatus { get; set; }

        /// <summary>
        /// 已重试次数
        /// </summary>
        public int RetryCount { get; set; }

        /// <summary>
        /// 锁定结束时间
        /// </summary>
        public DateTimeOffset SendAt { get; set; }

        /// <summary>
        /// 锁定结束时间
        /// </summary>
        public DateTimeOffset? LockEndTime { get; set; }

        /// <summary>
        /// 过期时间
        /// </summary>
        public DateTimeOffset? ExpireTime { get; set; }

    }
}
